package edu.midir.demo.service.impl;

import edu.midir.demo.dao.UserDAO;
import edu.midir.demo.pojo.domain.UserEntity;
import edu.midir.demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Service
public class UserServiceImpl implements UserService {

    private final UserDAO userDAO;

    @Autowired
    public UserServiceImpl(UserDAO userDAO) {
        this.userDAO = userDAO;
    }


    @Override
    public void saveUser(UserEntity userEntity) {
        userDAO.saveUser(userEntity);
    }

    @Override
    public UserEntity findUserByNickName(String userName) {
        return userDAO.findUserByNickName(userName);
    }

    @Override
    public void updateUser(UserEntity user) {
        userDAO.updateUser(user);
    }

    @Override
    public void deleteUserById(Long id) {
        userDAO.deleteUserById(id);
    }
}
